#!/bin/bash

# 设置Go环境变量
export GOARCH=amd64
export CGO_ENABLED=0
export LANG=zh_CN.UTF-8

# 从product.go文件中读取Version
VERSION=$(grep 'var Version = ' libs/product.go | cut -d'"' -f2)

# 编译Windows版本
echo "正在编译Windows版本..."
export GOOS=windows
go build -o "../Release/EditToServer-windows-${VERSION}.exe" main.go

# 编译Linux版本
echo "正在编译Linux版本..."
export GOOS=linux
go build -o "../Release/EditToServer-linux-${VERSION}" main.go

# 编译Mac版本
echo "正在编译Mac版本..."
export GOOS=darwin
go build -o "../Release/EditToServer-mac-${VERSION}" main.go

echo "编译完成。"
echo "Windows版本: EditToServer-windows-${VERSION}.exe"
echo "Linux版本: EditToServer-linux-${VERSION}"
echo "Mac版本: EditToServer-mac-${VERSION}"

read -p "按任意键继续..."
